<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.lmpop.trade.tb_commpara.Tb_commparaInfo" %>
<%@page import="com.lmpop.trade.ts_category.*" %>
<%@page import="com.lmpop.trade.ti_brand.Ti_brandInfo" %>
<%@page import="com.lmpop.trade.tb_ordergoods.Tb_ordergoodsInfo" %>
<%@page import="com.lmpop.trade.ti_orderinfo.*" %>
<%@page import="com.lmpop.trade.ti_customer.Ti_customerInfo" %>
<%@page import="com.lmpop.trade.ti_attach.Ti_attachInfo" %>
<%@page import="com.lmpop.trade.ts_categoryattr.Ts_categoryattrInfo" %>
<%@page import="com.lmpop.trade.ts_area.*" %>

<jsp:useBean id="randomId" class="com.lmpop.frame.util.RandomID" scope="page" /> 
<%
   
  
  
  
  String order_id=""; 
	
	if(request.getParameter("order_id")!=null )
	{
	   order_id  =request.getParameter("order_id");		
	} 
	
	
	   
  Tb_ordergoodsInfo tb_ordergoodsInfo =new Tb_ordergoodsInfo(); 
  
  
    Ti_orderinfoInfo ti_orderinfoInfo = new Ti_orderinfoInfo();
    List list = ti_orderinfoInfo.getListByPk(order_id);
  	Hashtable map = new Hashtable();
  	if(list!=null && list.size()>0) map = (Hashtable)list.get(0);
  	String order_no="",order_source="",order_state="",consignee="",area_attr="",address="";
  	String zip_code="",tel="",cellphone="",email="",best_time="",sign_building="",shipping_id="",shipping_name="";
  	String pay_id="",pay_name="",how_oos="",all_goods_amount="",all_shipping_fee="",all_pack_fee="",all_tax_invoice="";
  	String all_total_amount="",all_user_money="",all_integral_money="",all_discount="",all_confirm_money="";
  	String all_paid_amount="",add_time="",user_id2="",user_id="";
  	if(map.get("order_no")!=null) order_no = map.get("order_no").toString();
  	//if(map.get("order_source")!=null) order_source = map.get("order_source").toString();
  	if(map.get("user_id")!=null) user_id = map.get("user_id").toString();
  	if(map.get("order_state")!=null) order_state = map.get("order_state").toString();
    if(map.get("consignee")!=null) consignee = map.get("consignee").toString();
  	//if(map.get("area_attr")!=null) area_attr = map.get("area_attr").toString();
  	if(map.get("address")!=null) address = map.get("address").toString();
  	if(map.get("zip_code")!=null) zip_code = map.get("zip_code").toString();
  	if(map.get("tel")!=null) tel = map.get("tel").toString();
  	if(map.get("cellphone")!=null) cellphone = map.get("cellphone").toString();
  	if(map.get("email")!=null) email = map.get("email").toString();
  	if(map.get("best_time")!=null) best_time = map.get("best_time").toString();
  	if(map.get("sign_building")!=null) sign_building = map.get("sign_building").toString();
  	if(map.get("shipping_id")!=null) shipping_id = map.get("shipping_id").toString();
  	if(map.get("shipping_name")!=null) shipping_name = map.get("shipping_name").toString();
  	if(map.get("pay_id")!=null) pay_id = map.get("pay_id").toString();
  	if(map.get("pay_name")!=null) pay_name = map.get("pay_name").toString();
  	if(map.get("how_oos")!=null) how_oos = map.get("how_oos").toString();
  	if(map.get("all_goods_amount")!=null) all_goods_amount = map.get("all_goods_amount").toString();
  	if(map.get("all_shipping_fee")!=null) all_shipping_fee = map.get("all_shipping_fee").toString();
  	if(map.get("all_pack_fee")!=null) all_pack_fee = map.get("all_pack_fee").toString();
  	if(map.get("all_tax_invoice")!=null) all_tax_invoice = map.get("all_tax_invoice").toString();
  	if(map.get("all_total_amount")!=null) all_total_amount = map.get("all_total_amount").toString();
  	if(map.get("all_user_money")!=null) all_user_money = map.get("all_user_money").toString();
  	if(map.get("all_integral_money")!=null) all_integral_money = map.get("all_integral_money").toString();
  	if(map.get("all_discount")!=null) all_discount = map.get("all_discount").toString();
  	if(map.get("all_confirm_money")!=null) all_confirm_money = map.get("all_confirm_money").toString();
  	if(map.get("all_paid_amount")!=null) all_paid_amount = map.get("all_paid_amount").toString();
  	if(map.get("add_time")!=null) add_time = map.get("add_time").toString();
    
   
   
   Tb_commparaInfo tb_commparaInfo = new Tb_commparaInfo();
   //Ts_categoryInfo ts_categoryInfo = new Ts_categoryInfo();
   //Ti_brandInfo  ti_brandInfo = new  Ti_brandInfo();
   Ti_customerInfo  ti_customerInfo  = new Ti_customerInfo();
   Ti_attachInfo  ti_attachInfo = new Ti_attachInfo();
   Ts_categoryattrInfo ts_categoryattrInfo =new Ts_categoryattrInfo(); 
                                                   
   /*
   String ordersource = tb_commparaInfo.getOneComparaPcode1("16",order_source);
   
   
   String pack_str ="";
   if(!pack_id.trim().equals(""))
   {   
      pack_str = tb_commparaInfo.getOneComparaPcode1ByP3("25",pack_id);
   }
	 else
	 {
	     pack_str ="未设置包装方式";  
	 }
  
  String invoice ="";
  if(!invoice_no.trim().equals(""))
  {
     
    String invoice_no_str =  tb_commparaInfo.getOneComparaPcode1("21",invoice_no);
    String invoice_top_str =  tb_commparaInfo.getOneComparaPcode1("22",invoice_top);
    String invoice_content_str =  tb_commparaInfo.getOneComparaPcode1("23",invoice_content);
    invoice ="发票类型:"+invoice_no_str+" 发票抬头:"+invoice_top_str+" 发票内容:"+invoice_content_str;      
  }
  else
  {
    invoice  ="未设置发票信息"; 
  } 
 
 */   
   //String s_cat_all = ts_categoryInfo.getSelCatByTLevel("2","1");
   //String s_brand_all = ti_brandInfo.getBrandSelectAll("");
   Ts_areaInfo areaBean = new Ts_areaInfo();
   String areaAttr = "";
	 if (map.get("area_attr") != null) 
	 {
				area_attr = map.get("area_attr").toString();
				String areaArr[] = area_attr.split("\\|");
				for( int k = 0; k < areaArr.length; k++ )
				{
					areaAttr = areaAttr + "&nbsp;" + areaBean.getAreaNameById(areaArr[k]);
				}
	  } 
	  
    String state_name ="";
    if(order_state.equals("0"))
    {
       state_name="未确认";              
    }else if(order_state.equals("1")){
       state_name="已确认";                                
    }else if(order_state.equals("2")){
       state_name="取消";                                
    }else if(order_state.equals("3")){
       state_name="无效";                               
    }else if(order_state.equals("4")){
       state_name="交易中";                               
    }else if(order_state.equals("5")){
       state_name="交易完成";                                
    }

      

%>

	
	<style>

.listtab{margin:3px 0 3px 0;background:#c791aa;}
.listtab td{background:#FCF8FB; height:30px; padding-left:15px; padding-right:10px;}

.glisttab{margin:3px 0 3px 0;background:#cccccc;}
.glisttab td{background:#F9F9F9; height:30px; padding-left:15px; padding-right:10px;}



</style>

<div class="f-right w750">
    <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#eddfea">
      <tr>
        <td width="5%" height="40" align="center"><img src="/program/member/index/images/icon1.gif" /></td>
        <td width="75%"><h3>订单详细信息</h3></td>

      </tr>
    </table>


    <DIV class="focus-area-setTab">
      <DIV class="focus-area-setTab-menu">
        <DIV class="clear"></DIV>
      </DIV>
      <DIV class="focus-area-setTab-content">
        <DIV id=con_one_1 >
          <table width="100%" border="0" cellspacing="0" bgcolor="#fcf8fb" cellpadding="0" style="border-bottom:3px solid #eddfea; padding-left:15px;">
            <tr bgcolor="#fcf8fb">
              <td height="100" valign="top">
		  
			 
			 <table width="100%" border="0" cellpadding="0" cellspacing="1" class="listtab">
        
        <tr>
				<td  colspan="4" height="38" >
			      &nbsp;&nbsp;<img src="/program/admin/images/infotip.gif" border="0">&nbsp;&nbsp;<span style="font-size:14px;font-weight:bold;">基本信息</span>			
			   </td>
	       </tr>
          
          <tr>
             <td  height="38" class="art_col"  align="right" width="20%" >订单号:</td>
             <td  width="18%"><%=order_no%></td>
             <td  height="38" class="art_col" width="12%" align="right" >订单状态:</td>
             <td  width="60%"><%=state_name%></td>
          </tr> 
          
           <tr>
             <td  height="38" class="art_col"  align="right" width="20%" >支付方式:</td>
             <td  width="18%"> <%=pay_name%></td>
              <td  height="38" class="art_col" width="12%" align="right" >配送方式:</td>
             <td  width="60%"><%=shipping_name%></td>
          </tr>

				 <tr>
				   <td  colspan="4" height="38" >
			        &nbsp;&nbsp;<img src="/program/admin/images/infotip.gif" border="0">&nbsp;&nbsp;<span style="font-size:14px;font-weight:bold;">收货人信息</span>			
			     </td>
	       </tr>
           
            <tr>
             <td  height="38" class="art_col"  align="right" width="20%" >收货人:</td>
             <td  width="18%"> <%=consignee%></td>
              <td  height="38" class="art_col" width="12%" align="right" >电子邮件:</td>
             <td  width="60%"><%=email%></td>
          </tr>

          <tr>
             <td  height="38" class="art_col"  align="right" width="20%" >邮编:</td>
             <td  width="18%"> <%=zip_code%></td>
              <td  height="38" class="art_col" width="12%" align="right" >地区:</td>
             <td  width="60%"><%=areaAttr%></td>
          </tr> 
          
           <tr>
             <td  height="38" class="art_col"  align="right" width="20%" >详细地址:</td>
             <td  colspan="3"> <%=address%></td>
          </tr>

            <tr>
             <td  height="38" class="art_col"  align="right" width="20%" >手机:</td>
             <td  width="18%"> <%=cellphone%></td>
              <td  height="38" class="art_col" width="12%" align="right" >电话:</td>
             <td  width="60%"><%=tel%></td>
          </tr>

          <tr>
             <td  height="38" class="art_col"  align="right" width="20%" >标志性建筑:</td>
             <td  width="18%"> <%=sign_building%></td>
              <td  height="38" class="art_col" width="12%" align="right" >送货时间:</td>
             <td  width="60%"><%=best_time%></td>
          </tr>
        
          <tr>
				   <td  colspan="4" height="38" >
			        &nbsp;&nbsp;<img src="/program/admin/images/infotip.gif" border="0">&nbsp;&nbsp;<span style="font-size:14px;font-weight:bold;">商品及费用信息</span>			
			     </td>
	       </tr>  
	       
	        <tr>
				   <td  colspan="4" >
           <%
               List	goodslist = tb_ordergoodsInfo.getListByPk(order_id);
               if(goodslist!=null && goodslist.size()>0){ 
            %> 	
			       
			     <table width='100%' border="0" cellspacing="1" cellpadding="0" class="glisttab">	
	           	<tr>
	           		 <td width='10%'  align='left'>&nbsp;</td>	
	           		 <td>订单商品信息</td>
	           	</tr>	
           	    <%
           	   
           	   for(int k=0;k<goodslist.size();k++){
							     	Hashtable gmap = (Hashtable)goodslist.get(k);
								    String trade_id="",goods_id="",cust_id="",goods_state="",goods_name="",goods_attr="";		  			 
					  			  String goods_num="",paid_amount="",invoice_no="",invoice_top="";		  			  
			              String shop_price="",shipping_fee="",pack_id="",pack_fee="",tax_invoice="",discount="",confirm_money="";		  			  
			              String pay_time="",pay_all_time="",integral_money="",user_money="",rmb_money="",send_date="",send_no="";		  			 	
					  			 	String invoice_content="",mem_message="";		  			  
					  			  if(gmap.get("trade_id")!=null) trade_id = gmap.get("trade_id").toString();
								  	if(gmap.get("goods_id")!=null) goods_id = gmap.get("goods_id").toString();
								  	if(gmap.get("cust_id")!=null) cust_id = gmap.get("cust_id").toString();
								  	if(gmap.get("goods_state")!=null) goods_state = gmap.get("goods_state").toString();
								  	if(gmap.get("goods_name")!=null) goods_name = gmap.get("goods_name").toString();
								  	if(gmap.get("goods_num")!=null) goods_num = gmap.get("goods_num").toString();
								    if(gmap.get("paid_amount")!=null) paid_amount = gmap.get("paid_amount").toString();
								  	if(gmap.get("shop_price")!=null) shop_price = gmap.get("shop_price").toString();
								  	if(gmap.get("shipping_fee")!=null) shipping_fee = gmap.get("shipping_fee").toString();
								  	if(gmap.get("pack_fee")!=null) pack_fee = gmap.get("pack_fee").toString();
								  	if(gmap.get("tax_invoice")!=null) tax_invoice = gmap.get("tax_invoice").toString();
								  	if(gmap.get("confirm_money")!=null) confirm_money = gmap.get("confirm_money").toString();   
								  	if(gmap.get("pack_id")!=null) pack_id = gmap.get("pack_id").toString();  
								  	if(gmap.get("invoice_no")!=null)invoice_no = gmap.get("invoice_no").toString();
								    if(gmap.get("invoice_top")!=null)invoice_top = gmap.get("invoice_top").toString();
								    if(gmap.get("invoice_content")!=null)invoice_content = gmap.get("invoice_content").toString();

								  	
 
 

								  	
								  	/*
								  	String all_g_name = goods_name;  
			              if(goods_name.length()>26)
			              {
			                 goods_name = goods_name.substring(0,26);          
			              }					
                    */
								  	
								  	
								  	String company ="";
										if(!cust_id.equals(""))
			              {
											company  = ti_customerInfo.getCustNameByCustId(cust_id);         
			
										}

										String img_path =  ti_attachInfo.getFilePathByAttachrootid(goods_id);
										if(img_path.equals(""))
			              {
											img_path ="/program/member/images/cpwu.gif";            
										}
                    
                    String state_str ="";
				            if(goods_state.indexOf("a")>-1){state_str +="未确认," ;}  
			              if(goods_state.indexOf("b")>-1){state_str +="已确认," ;} 
			              if(goods_state.indexOf("c")>-1){state_str +="取消," ;}  
			              if(goods_state.indexOf("d")>-1){state_str +="无效," ;} 		
			              if(goods_state.indexOf("e")>-1){state_str +="未发货," ;}  
			              if(goods_state.indexOf("f")>-1){state_str +="配货中," ;} 	
			              if(goods_state.indexOf("g")>-1){state_str +="已发货," ;}  
			              if(goods_state.indexOf("h")>-1){state_str +="收货确认," ;} 
			              if(goods_state.indexOf("i")>-1){state_str +="未付款," ;}  
			              if(goods_state.indexOf("j")>-1){state_str +="已付款," ;} 		
			              if(goods_state.indexOf("k")>-1){state_str +="申请退款," ;}  
			              if(goods_state.indexOf("l")>-1){state_str +="退款确认," ;} 			
			              if(goods_state.indexOf("m")>-1){state_str +="交易完成," ;}  
                     
                    String pack_str ="";
								    if(!pack_id.trim().equals(""))
								    {   
								      pack_str = tb_commparaInfo.getOneComparaPcode1ByP3("25",pack_id);
								    }
									  else
									  {
									     pack_str ="未设置包装方式";  
									  }
									  
									  String invoice ="";
									  if(!invoice_no.trim().equals(""))
									  {
									     
									    String invoice_no_str =  tb_commparaInfo.getOneComparaPcode1("21",invoice_no);
									    String invoice_top_str =  tb_commparaInfo.getOneComparaPcode1("22",invoice_top);
									    String invoice_content_str =  tb_commparaInfo.getOneComparaPcode1("23",invoice_content);
									    invoice ="发票类型:"+invoice_no_str+" 发票抬头:"+invoice_top_str+" 发票内容:"+invoice_content_str;      
									  }
									  else
									  {
									    invoice  ="未设置发票信息"; 
									  } 


           	   
           	   
           	    
           	    %>
           
              <tr>
	           		 <td width='10%' height=120 align='left' >
	           	    <img src="<%=img_path%>" width="80" height="80" />
	           		 </td>	
	           		 
	           		 <td height=120 > 
	           		 	
	           		 		<span style="color:#303A43;">商品信息: </span> &nbsp;	<a href="#"><span style="color:#666666;"><%=goods_name%></a></span>
										<div style="margin-top:3px;"></div>	 				
					          <span style="color:#303A43;">发布商家: </span> &nbsp;	<span style="color:#666666;"><%=company%></span>
					          <div style="margin-top:3px;"></div>	 
					          <span style="color:#303A43;">交易状态:</span>  &nbsp;<span style="color:#666666;"><%=state_str%></span> 
					          <div style="margin-top:3px;"></div>	 				
					          <span style="color:#303A43;">包装方式: </span> &nbsp;	<span style="color:#666666;"><%=pack_str%></span>
					          <div style="margin-top:3px;"></div>	 
					          <span style="color:#303A43;">发票信息:</span> &nbsp; <span style="color:#666666;"><%=invoice%></span>
	           		 	   
	           		
	           		 </td>
           	   </tr>	
           	    
           	  <tr>
	           		 <td width='10%'  align='right'>费用小计</td>	
	           		  <td>
	           		  	
	           		  	  <div style="margin-top:3px;"></div>				    
									    <span style="color:#303A43;">商品价格</span>
                      <span style="color:#21759B;"><%=shop_price%>￥</span>
									    <span style="color:#95805D">*</span>&nbsp;<span style="color:#303A43;">购买数量</span>
                      &nbsp;<span style="color:#21759B;"><%=goods_num%></span> 
					            <span style="color:#95805D">+</span> <span style="color:#303A43;">配送费用 </span>
                      <span style="color:#21759B;"><%=shipping_fee%>￥</span>           
					            <span style="color:#95805D">+</span> <span style="color:#303A43;">包装费用 </span>
                      <span style="color:#21759B;"><%=pack_fee%>￥</span>           
					            <span style="color:#95805D">+</span> <span style="color:#303A43;">发票税额</span>
                      <span style="color:#21759B;"><%=tax_invoice%>￥</span> 
					            <div style="margin-top:3px;"></div> 
					            <span style="color:#95805D">-</span> <span style="color:#303A43;">已付款金额</span>
                      <span style="color:#21759B;"><%=paid_amount%>￥</span>
					         
					            <span style="color:#95805D">=</span> <span style="color:#303A43;">应付款</span>
                      <span style="color:#21759B;"><%=confirm_money%>￥</span> 
	           		  	
	           		  </td>
	           	 </tr>	
           	     
				       <%
				 
				        }
				        
				        %> 
				        
				 
				        <tr>
	           		  <td width='10%'  align='right'>订单费用总计</td>	
	           		  <td>
	           		  	
	           		  	 <div style="margin-top:3px;"></div>
	           		  	 <span style="color:#303A43;">商品总价</span><span style="color:#21759B;"><%=all_goods_amount%>￥</span> 
									   <span style="color:#95805D">+</span> <span style="color:#303A43;">配送总费用</span> <span style="color:#21759B;"><%=all_shipping_fee%>￥</span> 
									   <span style="color:#95805D">+</span> <span style="color:#303A43;">包装总费用</span> <span style="color:#21759B;"> <%=all_pack_fee%>￥</span> 
									   <span style="color:#95805D">+</span> <span style="color:#303A43;">发票总税额</span> <span style="color:#21759B;"> <%=all_tax_invoice%>￥</span> 
									 	 <div style="margin-top:3px;"></div>
									   <span style="color:#95805D">=</span> <span style="color:#303A43;">订单总金额 </span> <span style="color:#21759B;"> <%=all_total_amount%>￥</span> 
	           		  	 <span style="color:#95805D">-</span> <span style="color:#303A43;">已付款总金额</span> <span style="color:#21759B;"> <%=all_paid_amount%>￥</span> 
                     <span style="color:#95805D">=</span> <span style="color:#303A43;">应付款总金额</span> <span style="color:#21759B;"> <%=all_confirm_money%>￥</span> 
          		  	
          		  	
	           		  </td>
	            	</tr>	
				 
				 
				 
				 </table>				  

			     <%
           	 
           	    }       	
           
           	%>
           	
           	
           
     
			        
			     </td>
	       </tr>
 

	       
	       
	       
	       
	       
	       
	       
	        <tr>
				   <td  colspan="4" height="38" >
			        &nbsp;&nbsp;<img src="/program/admin/images/infotip.gif" border="0">&nbsp;&nbsp;<span style="font-size:14px;font-weight:bold;">其他信息</span>			
			     </td>
	       </tr>

          <tr>
             <td  height="38" class="art_col"  align="right" width="20%" >缺货处理:</td>
             <td  colspan="3"> 
              <%
						    if(how_oos.equals("0"))out.print("等待所有商品备齐后再发");
						    if(how_oos.equals("1"))out.print("取消订单");				 
		            if(how_oos.equals("2"))out.print("与店主协商");
				       %>	
             	</td>
          </tr> 
   

        </table>
		
				</td>
            </tr>
          </table>
          <table width="100%" border="0" cellspacing="0" cellpadding="0" >
            <tr>
              <td height="50" align="center">

			  <input type="button" name="Submit2" value=" 返 回 " class="button2" onclick="window.location.href='index.jsp'">
              </td>
            </tr>
          </table>
        </DIV>
      
      </DIV>
    </DIV>
  </div>
</div>